#include "EventPoller.h"
#include "Game.h"
#include "GameState.h"
#include "Screen.h"
#include "Timer.h"

void Game::Run()
{
	while (true)
	{
		Update();
		Draw();

		Screen::Instance()->Flip();
	}
	
}

void Game::Draw()
{
	m_state->Draw();
}

void Game::Update()
{
	TheTimer::Instance()->Update();
	TheEventPoller::Instance()->Update();

	m_state->Update();
}

void Game::SetGameState(GameState* gs) 
{ 
	m_state = gs; 
	TheEventPoller::Instance()->AddHandler(m_state);
}